package net.itgoo.parkingpay.ui.person;

import android.os.Bundle;

import androidx.annotation.Nullable;

import net.itgoo.parkingpay.R;
import net.itgoo.parkingpay.vendor.mvp.ParkingMVPUtils;
import net.itgoo.parkingpay.vendor.widget.activity.ParkingBaseActivity;

public class ParkingPersonActivity extends ParkingBaseActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.parking_activity_person);
        initUI();
    }

    private void initUI() {
        showMainFragment();
    }

    private void showMainFragment() {
        ParkingPersonFragment fragment =
                (ParkingPersonFragment) getSupportFragmentManager()
                        .findFragmentById(R.id.parking_activity_person_content_fl);

        if (fragment == null) {
            fragment = ParkingPersonFragment.newInstance(getIntent().getExtras());
            ParkingMVPUtils.addFragmentToActivity(getSupportFragmentManager(),
                    fragment, R.id.parking_activity_person_content_fl);
        }

        new ParkingPersonPresenter(null, fragment, new ParkingPersonDataRepository());
    }
}
